<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="ct-builder-list.html">
<link rel="import" href="ct-failure-group-data.html">

<script>
function CTBuilderFailureGroupData(failure, bot, examineUrl) {
  this.bot = bot;
  this.failure = failure;
  this.key = failure.key;
  this.builder = new CTBuilder(failure.masterUrl, failure.builder);
  this.category = 'builder';
  this.url = examineUrl;
};

CTBuilderFailureGroupData.prototype.getAnnotations = function() {
  return this.annotation ? [this.annotation] : [];
};

CTBuilderFailureGroupData.prototype.failureKeys = function() {
  return [this.failure.key];
};

// FIXME: Add tests for this.
CTBuilderFailureGroupData.prototype.fileBugMessage = function() {
  return '{failureState}\nFailing builder: {builder}: {masterUrl}\n'.assign(
      {failureState: this.failure.state, builder: this.builder.builder,
         masterUrl: this.builder.masterUrl});
};

CTBuilderFailureGroupData.prototype.fileBugLink = function() {
  return CTFailureGroupData.fileBugLink('Builder failure',
      'Build is broken:\n' + this.fileBugMessage(), this.bugLabels);
};

</script>
